import 'dart:ui';

import 'package:flutter/material.dart';


class WideCard extends StatelessWidget {
  final String label;
  final String imgStr;
  final bool isLocal;
  const WideCard(
      {Key? key,
        required this.label,
        required this.imgStr,
        required this.isLocal})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 150,
      decoration: image(),
      child: Container(
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(20),
            gradient: LinearGradient(
                begin: Alignment.bottomRight,
                stops: [
                  0.3,
                  0.9,
                ],
                colors: [
                  Colors.black.withOpacity(.7),
                  Colors.black.withOpacity(.2),
                ]
            )
        ),
        child: Align(
          alignment: Alignment.bottomLeft,
          child: Padding(
            padding: EdgeInsets.all(15),
            child: Text(
              label,
              style: TextStyle(
                color: Colors.white,
                fontSize: 20,
              ),
            ),
          ),
        ),
      ),
    );
  }

  BoxDecoration image(){
    if(isLocal == false)
      return BoxDecoration(
          borderRadius: BorderRadius.circular(20),
          image: DecorationImage(
            fit: BoxFit.cover,
            image: NetworkImage(imgStr),
          )
      );
    return BoxDecoration(
        borderRadius: BorderRadius.circular(20),
        image: DecorationImage(
          fit: BoxFit.cover,
          image: AssetImage(imgStr),
        )
    );
  }
}
